﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>批处理</title>
    <link href="../../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../../Scripts/easyUI145/themes/color.css" rel="stylesheet" />
    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script src="../../Admin.js"></script>
    <script src="DDLBar.js"></script>
    <script src="../../CCFlowEnum.js"></script>
    <script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script src="../../../Scripts/vue.js"></script>
    <script type="text/javascript" language="javascript">
        var nodeID = GetQueryString("FK_Node");
        var node = new Entity("BP.WF.Node", nodeID);
        var nodeID = GetQueryString("FK_Node");
        var node = null;

        //页面启动函数.
        $(function () {

            InitBar(BatchRole.Group);

            node = new Entity("BP.WF.Node", nodeID);

            //赋值.
            //GenerFullAllCtrlsVal(node);  效果不好
            //初始化批处理模式
            var selVal = node.GetPara("BatchCheckNoteModel");
            $("#DDL_BatchCheckNoteModel option[value='" + selVal + "']").attr("selected", true);

            var listCount = node.GetPara("BatchCheckListCount");
             if (listCount == 0 || listCount == null || listCount == undefined)
                listCount = 15;

            $("#TB_BatchCheckListCount").val(listCount);

            //查询该流程的所有字段.
            var frmID = "ND" + parseInt(node.FK_Flow) + "Rpt";
            var mapAttrs = new Entities("BP.Sys.MapAttrs");
            mapAttrs.Retrieve("FK_MapData", frmID);
            var html = "";
            for (var i = 0; i < mapAttrs.length; i++) {

                var en = mapAttrs[i];

                if (en.UIVisible == false)
                    continue;

                html += "<option value='" + en.KeyOfEn + "'>" + en.Name + "</option>";
            }
            $("#DDL_BatchCheckNoteField").append(html);

            //动态加载可现实的字段
            html = "<table class='table'>";
            html += "<tr>";
            html += "<th>#</th>";
            html += "<th>标题</th>";
            var files = "";
            files = node.GetPara("BatchFields");
            var num = 2;
            for (var i = 0; i < mapAttrs.length; i++) {

                var en = mapAttrs[i];
                if (files == undefined)
                    continue;
                if (files.indexOf(en.KeyOfEn) == -1)
                    continue;
                html += "<th>" + en.Name + "</th>";
                num++;
            }
            html += "</tr>";

            html += "<tr>";
            for (var i = 0; i < num; i++) {
                html += "<td></td>";
            }
            html += "</tr>";
            html += "</table>";
            $("#list").html(html);

            //初始化字段分组
            var selCheckNoteField = node.GetPara("BatchCheckNoteField");
            $("#DDL_BatchCheckNoteField option[value='" + selCheckNoteField + "']").attr("selected", true);

        });
        function GotoFields() {
            var url = "BatchStartFields.htm" + "?FK_Node=" + GetQueryString("FK_Node") + "&FK_Flow=" + GetQueryString("FK_Flow");
            OpenEasyUiDialogExtCloseFunc(url, '设置字段', 800, 500, function () {
                window.location.reload();
            });
        }
        function Save() {

            $("#Btn_Save").val('正在保存请稍候...');

            node.BatchRole = BatchRole.Group;

            //设置审核意见的模式.
            var selVal = $("#DDL_BatchCheckNoteModel option:selected").val();
            node.SetPara("BatchCheckNoteModel", selVal);
            //设置显示的行数
            var listCount = $("#TB_BatchCheckListCount").val();
            if (listCount == 0 || listCount == null || listCount == undefined)
                listCount = 15;

            node.SetPara("BatchCheckListCount", listCount);
            //设置字段分组
            var selCheckNoteField = $("#DDL_BatchCheckNoteField option:selected").val();
            node.SetPara("BatchCheckNoteField", selCheckNoteField);
            node.Update();

            window.location.href = window.location.href;
        }

    </script>
</head>
<body>
    <div id="bar">

    </div>
    <form id="cc">
        <fieldset>

            <legend>
                <label>审核字段分组模式</label>
            </legend>
            <br />
            <ul>
                <li>
                    <label>填写意见格式 </label>
                    <select id="DDL_BatchCheckNoteModel">
                        <option value="0">选择的多条记录一个意见框. </option>
                        <option value="1">每个记录后面都有一个意见框. </option>
                        <option value="2">无意见</option>
                    </select>
                </li>
                <li>
                    <label>批处理列显示行数:</label><input type="text" id="TB_BatchCheckListCount" />
                </li>
                <li>
                    <label>设置分组</label>
                    <select id="DDL_BatchCheckNoteField">
                    </select>
                </li>
            </ul>
        </fieldset>

        <fieldset>

            <legend>
                显示的字段列表
                - <input type="button" onclick="GotoFields()" value="设置显示的字段" />
            </legend>
            <br />
            <div id="list"></div>

        </fieldset>

    </form>

</body>
</html>
